<!DOCTYPE html>

















































<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <meta name="description" content="Javadoc API documentation for Gimlet." />

<link rel="shortcut icon" type="image/x-icon" href="../../../../../favicon.ico" />
<title>

  NestedScope


| Gimlet

</title>
<link href="../../../../../../assets/doclava-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../../../../../../assets/customizations.css" rel="stylesheet" type="text/css" />
<script src="../../../../../../assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../../../../../assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../../../../../assets/doclava-developer-docs.js" type="text/javascript"></script>
<script src="../../../../../../assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
  setToRoot("../../../../../", "../../../../../../assets/");
</script>
<script src="../../../../../../assets/doclava-developer-reference.js" type="text/javascript"></script>
<script src="../../../../../../assets/navtree_data.js" type="text/javascript"></script>
<script src="../../../../../../assets/customizations.js" type="text/javascript"></script>
<noscript>
  <style type="text/css">
    html,body{overflow:auto;}
    #body-content{position:relative; top:0;}
    #doc-content{overflow:visible;border-left:3px solid #666;}
    #side-nav{padding:0;}
    #side-nav .toggle-list ul {display:block;}
    #resize-packages-nav{border-bottom:3px solid #666;}
  </style>
</noscript>
</head>

<body class="">

<div id="header">
    <div id="headerLeft">
    
      <span id="masthead-title">Gimlet</span>
    
    </div>
    <div id="headerRight">
      
  <div id="search" >
      <div id="searchForm">
          <form accept-charset="utf-8" class="gsc-search-box" 
                onsubmit="return submit_search()">
            <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
                <tr>
                  <td class="gsc-input">
                    <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
                      title="search developer docs" name="q"
                      value="search developer docs"
                      onFocus="search_focus_changed(this, true)"
                      onBlur="search_focus_changed(this, false)"
                      onkeydown="return search_changed(event, true, '../../../../../')"
                      onkeyup="return search_changed(event, false, '../../../../../')" />
                  <div id="search_filtered_div" class="no-display">
                      <table id="search_filtered" cellspacing=0>
                      </table>
                  </div>
                  </td>
                  <td class="gsc-search-button">
                    <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
                  </td>
                  <td class="gsc-clear-button">
                    <div title="clear results" class="gsc-clear-button">&nbsp;</div>
                  </td>
                </tr></tbody>
              </table>
          </form>
      </div><!-- searchForm -->
  </div><!-- search -->
      
    </div>
</div><!-- header -->


  <div class="g-section g-tpl-240" id="body-content">
    <div class="g-unit g-first side-nav-resizable" id="side-nav">
      <div id="swapper">
        <div id="nav-panels">
          <div id="resize-packages-nav">
            <div id="packages-nav">
              <div id="index-links"><nobr>
                <a href="../../../../../packages.html"  >Package Index</a> | 
                <a href="../../../../../classes.html" >Class Index</a></nobr>
              </div>
              <ul>
                
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/batching/package-summary.html">com.google.gimlet.batching</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/collect/package-summary.html">com.google.gimlet.collect</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/commonality/package-summary.html">com.google.gimlet.commonality</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/introspectingscoper/package-summary.html">com.google.gimlet.inject.introspectingscoper</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/introspectingscoper/defaults/package-summary.html">com.google.gimlet.inject.introspectingscoper.defaults</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/introspectingscoper/noop/package-summary.html">com.google.gimlet.inject.introspectingscoper.noop</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/legprovider/package-summary.html">com.google.gimlet.inject.legprovider</a></li>
    <li class="selected api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/nestedscope/package-summary.html">com.google.gimlet.inject.nestedscope</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/inject/nestedscope/testing/package-summary.html">com.google.gimlet.inject.nestedscope.testing</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/parallel/package-summary.html">com.google.gimlet.parallel</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/reflect/package-summary.html">com.google.gimlet.reflect</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/testing/easymock/package-summary.html">com.google.gimlet.testing.easymock</a></li>
    <li class="api apilevel-">
  <a href="../../../../../com/google/gimlet/testing/tl4j/package-summary.html">com.google.gimlet.testing.tl4j</a></li>
              </ul><br/>
            </div> <!-- end packages -->
          </div> <!-- end resize-packages -->
          <div id="classes-nav">
            <ul>
              
    <li><h2>Interfaces</h2>
      <ul>
          <li class="selected api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html">NestedScope</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a></li>
      </ul>
    </li>
              
    <li><h2>Classes</h2>
      <ul>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScopeBasedProvider.html">NestedScopeBasedProvider</a>&lt;T&gt;</li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScopeCallableTransform.html">NestedScopeCallableTransform</a>&lt;T&gt;</li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScopeClassMatcher.html">NestedScopeClassMatcher</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScopeInterceptorModule.html">NestedScopeInterceptorModule</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScopeModule.html">NestedScopeModule</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeIdBasedBinder.html">ScopeIdBasedBinder</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/ValueBasedScopeId.html">ValueBasedScopeId</a></li>
      </ul>
    </li>
              
    <li><h2>Annotations</h2>
      <ul>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/CaptureInNestedScope.html">CaptureInNestedScope</a></li>
          <li class="api apilevel-"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScoped.html">NestedScoped</a></li>
      </ul>
    </li>
              
              
              
            </ul><br/>
          </div><!-- end classes -->
        </div><!-- end nav-panels -->
        <div id="nav-tree" style="display:none">
          <div id="index-links"><nobr>
            <a href="../../../../../packages.html"  >Package Index</a> | 
            <a href="../../../../../classes.html" >Class Index</a></nobr>
          </div>
        </div><!-- end nav-tree -->
      </div><!-- end swapper -->
    </div> <!-- end side-nav -->
    <script>
      if (!isMobile) {
        $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
        chooseDefaultNav();
        if ($("#nav-tree").is(':visible')) {
          init_default_navtree("../../../../../");
        } else {
          addLoadEvent(function() {
            scrollIntoView("packages-nav");
            scrollIntoView("classes-nav");
          });
        }
        $("#swapper").css({borderBottom:"2px solid #aaa"});
      } else {
        swapNav(); // tree view should be used on mobile
      }
    </script>



<div class="g-unit" id="doc-content">

<div id="api-info-block">



  
   
  
  
  
  


<div class="sum-details-links">


Summary:











  <a href="#pubmethods">Methods</a>
  



  &#124; <a href="#inhmethods">Inherited Methods</a>

&#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>

</div><!-- end sum-details-links -->
<div class="api-level">
  


  
  

</div>
</div><!-- end api-info-block -->


<!-- ======== START OF CLASS DATA ======== -->

<div id="jd-header">
    public
     
     
    
    interface
<h1>NestedScope</h1>



  
  
      implements 
      
        Scope 
      
  
  


</div><!-- end header -->

<div id="naMessage"></div>

<div id="jd-content" class="api apilevel-">
<table class="jd-inheritance-table">


    <tr>
         	
        <td colspan="1" class="jd-inheritance-class-cell">com.google.gimlet.inject.nestedscope.NestedScope</td>
    </tr>
    

</table>






<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">

  <a href="#" onclick="return toggleInherited(this, null)" id="subclasses-indirect" class="jd-expando-trigger closed"
          ><img id="subclasses-indirect-trigger"
          src="../../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>Known Indirect Subclasses

  <div id="subclasses-indirect">
      <div id="subclasses-indirect-list"
              class="jd-inheritedlinks"
              
              >
          
            
              <a href="../../../../../com/google/gimlet/inject/nestedscope/testing/TestNestedScope.html">TestNestedScope</a>
            
          
      </div>
      <div id="subclasses-indirect-summary"
              style="display: none;"
              >
  <table class="jd-sumtable-expando">
        <tr class="alt-color api apilevel-" >
              <td class="jd-linkcol"><a href="../../../../../com/google/gimlet/inject/nestedscope/testing/TestNestedScope.html">TestNestedScope</a></td>
              <td class="jd-descrcol" width="100%">This class provides a testing-based implementation of <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html">NestedScope</a></code>.&nbsp;</td>
          </tr>
  </table>
      </div>
  </div>
</td></tr></table>


<div class="jd-descr">


<h2>Class Overview</h2>
<p>This is a Scope that may be used to encompass a logical unit of work.
 It provides explicit methods to enter and exist a scope.  This scoping is
 <em>nestable</em>, which means that that it is possible for a scoped value to
 be shadowed by a newer value that is scoped within a subsequent scope.</p>





</div><!-- jd-descr -->
















<div class="jd-descr">


<h2>Summary</h2>



























<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>



	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enter(com.google.gimlet.inject.nestedscope.ScopeId)">enter</a></span>(<a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a> scopeId)</nobr>
        
        <div class="jd-descrdiv">This method enters into a new nested scope.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew()">enterNew</a></span>()</nobr>
        
        <div class="jd-descrdiv">Calls <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew(com.google.gimlet.inject.nestedscope.ScopeId)">enterNew(ScopeId)</a></code> with <code><a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html#DEFAULT">DEFAULT</a></code>.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew(com.google.gimlet.inject.nestedscope.ScopeId)">enterNew</a></span>(<a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a> scopeId)</nobr>
        
        <div class="jd-descrdiv">Similar to <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enter(com.google.gimlet.inject.nestedscope.ScopeId)">enter(ScopeId)</a></code>, but guarantees that a new scope will
 be entered.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#exit()">exit</a></span>()</nobr>
        
        <div class="jd-descrdiv">Must be called when the unit of work completes.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            &lt;T&gt;
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#put(com.google.inject.Key<T>, T)">put</a></span>(Key&lt;T&gt; key, T object)</nobr>
        
        <div class="jd-descrdiv">Allows you to add an <code>object</code> in scope.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            &lt;T&gt;
            void</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad"><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#put(java.lang.Class<T>, T)">put</a></span>(<a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/Class.html">Class</a>&lt;T&gt; clazz, T object)</nobr>
        
        <div class="jd-descrdiv">Same as <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#put(com.google.inject.Key<T>, T)">put(Key, Object)</a></code>, but accepts a <code><a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/Class.html">Class</a></code> from which
 a Key is created.</div>
  
  </td></tr>



</table>







<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
  <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
  <div style="clear:left;">Inherited Methods</div></th></tr>


<tr class="api apilevel-" >
<td colspan="12">
  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-com.google.inject.Scope" class="jd-expando-trigger closed"
          ><img id="inherited-methods-com.google.inject.Scope-trigger"
          src="../../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>
From interface

  com.google.inject.Scope

<div id="inherited-methods-com.google.inject.Scope">
  <div id="inherited-methods-com.google.inject.Scope-list"
        class="jd-inheritedlinks">
  </div>
  <div id="inherited-methods-com.google.inject.Scope-summary" style="display: none;">
    <table class="jd-sumtable-expando">
    


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            &lt;T&gt;
            Provider&lt;T&gt;</nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">scope</span>(Key&lt;T&gt; arg0, Provider&lt;T&gt; arg1)</nobr>
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol"><nobr>
            abstract
            
            
            
            
            <a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/String.html">String</a></nobr>
        </td>
        <td class="jd-linkcol" width="100%"><nobr>
        <span class="sympad">toString</span>()</nobr>
        
  </td></tr>


</table>
  </div>
</div>
</td></tr>


</table>


</div><!-- jd-descr (summary) -->

<!-- Details -->








<!-- XML Attributes -->


<!-- Enum Values -->


<!-- Constants -->


<!-- Fields -->


<!-- Public ctors -->



<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->



<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->

<h2>Public Methods</h2>



<A NAME="enter(com.google.gimlet.inject.nestedscope.ScopeId)"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">enter</span>
      <span class="normal">(<a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a> scopeId)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>This method enters into a new nested scope.  It may be called during a
 unit of work, or at the start of a unit of work.  It is preferable to
 call <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew()">enterNew()</a></code> or <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew(com.google.gimlet.inject.nestedscope.ScopeId)">enterNew(ScopeId)</a></code> at the beginning of
 a new unit of work, because those methods will check whether the current
 thread is already within a unit of work.  Hence, this method must be
 used to enter a nested unit of work.
 <p>
 If the given <code><a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a></code> is a duplicate of an outer scope, then an
 IllegalArgumentException is thrown.
</p></div>

    </div>
</div>


<A NAME="enterNew()"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">enterNew</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Calls <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enterNew(com.google.gimlet.inject.nestedscope.ScopeId)">enterNew(ScopeId)</a></code> with <code><a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html#DEFAULT">DEFAULT</a></code>. </p></div>

    </div>
</div>


<A NAME="enterNew(com.google.gimlet.inject.nestedscope.ScopeId)"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">enterNew</span>
      <span class="normal">(<a href="../../../../../com/google/gimlet/inject/nestedscope/ScopeId.html">ScopeId</a> scopeId)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Similar to <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#enter(com.google.gimlet.inject.nestedscope.ScopeId)">enter(ScopeId)</a></code>, but guarantees that a new scope will
 be entered. The exact behavior of this method is implementation dependent.
</p></div>

    </div>
</div>


<A NAME="exit()"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">exit</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Must be called when the unit of work completes. </p></div>

    </div>
</div>


<A NAME="put(com.google.inject.Key<T>, T)"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">put</span>
      <span class="normal">(Key&lt;T&gt; key, T object)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Allows you to add an <code>object</code> in scope. Must be called in between
 <code>enter</code> and <code>exit</code>.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">  
        <tr>
            <th><a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/IllegalStateException.html">IllegalStateException</a></td>
            <td>if an object already exists in this scope
 for the given <code>key</code>
</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<A NAME="put(java.lang.Class<T>, T)"></A>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
        abstract 
         
        void
      </span>
      <span class="sympad">put</span>
      <span class="normal">(<a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/Class.html">Class</a>&lt;T&gt; clazz, T object)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Same as <code><a href="../../../../../com/google/gimlet/inject/nestedscope/NestedScope.html#put(com.google.inject.Key<T>, T)">put(Key, Object)</a></code>, but accepts a <code><a href="http://download.oracle.com/javase/6/docs/api/index.html?java/lang/Class.html">Class</a></code> from which
 a Key is created.
</p></div>

    </div>
</div>





<!-- ========= METHOD DETAIL ======== -->



<!-- ========= END OF CLASS DATA ========= -->
<A NAME="navbar_top"></A>

<div id="footer">
Generated by <a href="http://code.google.com/p/doclava/">Doclava</a>.
</div> <!-- end footer -->

</div> <!-- jd-content -->

</div><!-- end doc-content -->

</div> <!-- end body-content --> 

<script type="text/javascript">
init(); /* initialize doclava-developer-docs.js */
</script>

</body>
</html>
